package cn.elwy.rcp.ui.table.listener;

import java.beans.PropertyChangeEvent;

import cn.elwy.rcp.ui.table.TablePane;
import cn.elwy.rcp.ui.table.event.EventManager;

public abstract class TablePanePropertyListener extends PropertyListener {

  protected TablePane tablePane;

  public void setTablePane(TablePane tablePane) {
    this.tablePane = tablePane;
  }

  public void dispose() {
    tablePane = null;
    unregistListener();
  }

  @Override
  public void propertyChange(PropertyChangeEvent evt) {
    if (tablePane == null) {
      return;
    }
    super.propertyChange(evt);
  }

  @Override
  protected void registOtherListener() {
    if (tablePane == null) {
      return;
    }
    EventManager.unregistListenerAtWidgetDispose(this, tablePane);
  }
}
